<%@ page language="java"  pageEncoding="UTF-8"%>
<%@ include file="/views/commons/taglibs.jsp" %>
<!DOCTYPE html>
<html>
<head>
	<meta charset="UTF-8">
	<title>众秀众筹</title>
	<meta name="Keywords" content="众筹，众筹网，众筹导航，众筹门户，股权众筹，众筹平台，众筹圈子人，众筹项目，众筹三方
影视众筹，店铺众筹，餐饮众筹，众筹报告，创业众筹，投后管理，项目融资，项目众筹，权力的游戏，冰与火之歌" />
	<meta name="Description" content="汇集各行业高手分析众筹项目，行业问答，众筹资讯。" />
	<meta content="IE=edge,chrome=1" http-equiv="X-UA-Compatible" />
	<meta name="renderer" content="webkit"/>
	<link rel="stylesheet" href="<%=path%>/css/bootstrap/3.3.5/css/bootstrap.min.css" />
	<link rel="stylesheet" href="<%=path%>/css/cropper.min.css" />
	<link rel="stylesheet" href="<%=path%>/css/cz.css" />

	<script src="<%=path%>/js/jquery-1.11.0.min.js"></script>
	<script src="<%=path%>/js/plugins/datapicker/bootstrap-datepicker.js"></script>
	<script src="<%=path%>/js/plugins/layer/layer.js"></script>
	<script src="<%=path%>/css/bootstrap/3.3.5/js/bootstrap.min.js"></script>

	<script src="<%=path%>/js/slider.js"></script>
	<script src="<%=path%>/js/cropper.min.js"></script>
	<script src="<%=path%>/js/common.js"></script>
	<script type="text/javascript" src="<%=path %>/js/plugins/ajaxfileupload.js"></script>
<body class="gray-bg">
<jsp:include page="/views/commons/header.jsp"></jsp:include>
<div class="container page-single">
	<div class="col-md-12">
		<div class="panel panel-default">
			<div class="panel-heading">
				<h3 class="panel-title">活动编辑</h3>
			</div>
			<div class="panel-body event-create">
				<form id="banner_update_form" class="form-horizontal" action="javascript:updateBannerConfig()">
					
					<input type="hidden" id="banner_id" name="bannerId" value="${banner.bannerId}">
					
					<div class="form-group">
						<label for="aa" class="col-sm-1 control-label">banner图片<em>*</em></label>
						<div class="col-sm-10">
							<div class="img-container">
								<img src="<%=path %>/uncheck/pictures/servlet?id=${banner.bannerPicture}" id="banner_image_img"  width="100%" height="100%">
							</div>
							<label class="btn btn-primary" for="banner_file" title="上传图片">
								<input type="file" class="hide" id="banner_file" name="file" accept="image/*" 
								onchange="javascript:uploadImage('banner_image_img','banner_file','banner_image',2)">上传图片
							</label>
							<input type="hidden" id="banner_image" name="bannerPicture" value="${banner.bannerPicture}">
						</div>
					</div>
					
					<div class="form-group">
						<label class="col-sm-1 control-label">banner名称<em>*</em></label>
						<div class="col-sm-10">
							<input type="text" class="form-control"  name="bannerName" value="${banner.bannerName}">
						</div>
					</div>
					<div class="form-group">
						<label class="col-sm-1 control-label">banner序号<em>*</em></label>
						<div class="col-sm-10">
							<input type="text" class="form-control" placeholder="序号大的显示在前面" name="bannerNo" value="${banner.bannerNo}">
						</div>
					</div>
					<div class="form-group">
						<label class="col-sm-1 control-label">banner链接地址</label>
						<div class="col-sm-10">
							<input type="text" class="form-control" placeholder="可为空" name="bannerUrl" value="${banner.bannerUrl}" >
						</div>
					</div>
					<div class="form-group" id="data_banner_start_time">
						<label class="col-sm-1 control-label">上线时间<em>*</em></label>
						<div class="col-sm-5">
							<div id="datepicker" class="input-daterange input-group">
								<input type="text"  name="startTime"  value="<fmt:formatDate value='${banner.startTime}' pattern='yyyy-MM-dd HH:mm:ss' />" class="input-sm form-control">
							</div>
						</div>
						<label class="col-sm-1 control-label">下线时间<em>*</em></label>
						<div class="col-sm-5">
							<div id="datepicker" class="input-daterange input-group">
								<input type="text"  name="endTime"  value="<fmt:formatDate value='${banner.endTime}' pattern='yyyy-MM-dd HH:mm:ss' />" class="input-sm form-control">
							</div>
						</div>
					</div>
					<div class="form-group">
						<div class="col-sm-offset-1 col-sm-10">
							<button type="submit" class="btn btn-primary" id="banner_update_btn">确定</button>
						</div>
					</div>
				</form>
			</div>
		</div>
	</div>
</div>

<jsp:include page="/views/commons/footer.jsp"></jsp:include>

<script type="text/javascript">
	$(function() {
		$("#data_banner_start_time .input-daterange").datepicker({
			keyboardNavigation: !1,
			forceParse: !1,
			autoclose: !0
		});
		$("#data_banner_end_time .input-daterange").datepicker({
			keyboardNavigation: !1,
			forceParse: !1,
			autoclose: !0
		});
	})
	
	function updateBannerConfig(){
		$("#banner_update_btn").addClass("disabled").attr("disabled","disabled").val("提交中");
		$.ajax({
			url : path + "/admin/banner/update",
			type : "post",
			dataType : "json",
			data : $("#banner_update_form").serialize(),
			success : function(data)
			{
				if(data.result){
					layer.msg("发布成功",{icon: 1});
					window.location.href=path + "/";
				}else{
					layer.msg(data.message,{icon: 2});
					$("#banner_update_btn").removeClass("disabled").removeAttr("disabled").val("提交");
				}
			},error:function(){
				layer.msg("服务器网络繁忙",{icon: 2});
				$("#banner_update_btn").removeClass("disabled").removeAttr("disabled").val("提交");
			}
		});
	}
	</script>
</body>
</html>